#!/usr/bin/env node

const fs = require('fs');

const src = process.argv[2];
const dst = process.argv[3];

fs.readFile(src, (err, data) => {
  if (err) {
    console.error('Error reading source file:', err.message);
    return;
  }
  fs.stat(src, (err, stat) => {
    if (err) {
      console.error('Error stating source file:', err.message);
      return;
    }
    fs.writeFile(dst, data, { mode: stat.mode }, err => {
      if (err) {
        console.error('Error writing to destination file:', err.message);
      } else {
        console.log('File copied successfully');
      }
    });
  });
});